import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Scanner;import java.util.Scanner;

public class test9 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int[][] array=new int[n][m];
        int sum=0;
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<m;j++)
            {
                array[i][j]=sc.nextInt();
                if(array[i][j]>0)
                {
                    sum+=array[i][j];
                }
            }
        }
        System.out.println(sum);
    }


    public static void main15(String[] args){
        Scanner sc = new Scanner(System.in);
        int n;
        while(sc.hasNextInt()){
            n = sc.nextInt();
            StringBuffer str = new StringBuffer();
            for(int i = 0; i < n; i++){
                for(int j = 0; j < n; j++){
                    if(j >= i){
                        str.append("* ");
                    } else {
                        str.append(" ");
                    }
                }
                str.append("\n");
            }
            System.out.print(str.toString());
        }
    }

    public static void main11(String[] args) {

        Scanner sc = new Scanner(System.in);
        while(sc.hasNextInt()) {
            int num = sc.nextInt();
            for(int i = 1 ; i <= num + 1 ; i++) {
                for(int k = i ; k <= num ; k++) {    //输出空格
                    System.out.print("  ");
                }
                for(int j = 1 ; j <= i ; j++) {
                    System.out.print("*");
                }
                System.out.println();
            }
            for(int i = 1 ; i <= num ; i++) {
                for(int k = 1 ; k <= i ; k++) {
                    System.out.print("  ");
                }
                for(int j = num ; j >= i ; j--) {
                    System.out.print("*");
                }
                System.out.println();
            }
        }
    }

    public static void main10(String[] args) {
        Scanner in = new Scanner(System.in);
        String birthDate = in.nextLine();
        System.out.println("year=" + birthDate.substring(0,4));//substring是关键
        System.out.println("month=" + birthDate.substring(4,6));
        System.out.println("date=" + birthDate.substring(6,8));
    }


    public static void main9(String[] args) {

        Scanner sc = new Scanner(System.in);
        while(sc.hasNextInt()) {
            int n = sc.nextInt();
            for(int i = 0 ; i < n ; i++) {
                for(int j = 0 ; j <= i ; j++) {
                    if(j > 0 && j < i && i < n - 1) {
                        System.out.print("  ");
                    } else {
                        System.out.print("* ");
                    }
                }
                System.out.println();
            }
        }
    }

    public static void main8(String[] args) {
        Scanner scan = new Scanner(System.in);
        while (scan.hasNext()) {
            int n = scan.nextInt();
            for (int i = 1; i <= n; i++) {
                if (i != 1 && i != n) {
                    System.out.print("* ");
                    for (int j = 1; j <= n - 2; j++)
                        System.out.print("  ");
                    System.out.print("* ");
                } else
                    for (int j = 1; j <= n; j++) {
                        System.out.print("* ");
                    }
                System.out.println();
            }
        }
    }


        public static void main7(String[] args) {
            Scanner scanner = new Scanner(System.in);
            while(scanner.hasNextInt()) {
                int n = scanner.nextInt();
                if(n % 2 == 0) {
                    System.out.println("Even");
                } else {
                    System.out.println("Odd");
                }
            }
        }

        public static void main6(String[] args) {
            Scanner sc = new Scanner(System.in);
            while(sc.hasNextInt()) {
                int n = sc.nextInt();
                for(int i=1;i<=n;i++) {
                    for(int j=n;j>i;j--) {
                        System.out.print(" ");
                    }
                    for(int j=1; j<=i;j++) {
                        System.out.print("* ");
                    }
                    System.out.println();
                }
            }
        }
        public static void main5(String[] args) {
            Scanner scanner = new Scanner(System.in);
            while(scanner.hasNextInt()) {
                int score = scanner.nextInt();
                if(score >= 60) {
                    System.out.println("Pass");
                } else {
                    System.out.println("Fail");
                }
            }

        }

        public static void main0(String[] args) {

            Scanner sc = new Scanner(System.in);
            double weight = sc.nextDouble();
            double height = sc.nextDouble();
            double bmi = weight / (height * height);
            if(bmi >= 18.5 && bmi <= 23.9) {
                System.out.println("Normal");
            } else {
                System.out.println("Abnormal");
            }
        }

    public static int []transform(int [] array){
        for (int i=0;i<array.length;i++){
            array[i]=array[i]*2;
        }
        return array;

    }
    public static void main1(String[] args) {
        int []array ={1,2,3};
        int []ret =transform(array);
        System.out.println(Arrays.toString(ret));

    }
}
